//
//  UIFont+CLFont.m
//  CLBrowser
//
//  Created by 梁慧聪 on 2021/7/9.
//

#import "UIFont+CLFont.h"
/**
 *  极细体
 */
static NSString *const CLPingFangSC_Ultralight = @"PingFangSC-Ultralight";
/**
 *  常规体
 */
static NSString *const CLPingFangSC_Regular = @"PingFangSC-Regular";
/**
 *  中粗体
 */
static NSString *const CLPingFangSC_Semibold = @"PingFangSC-Semibold";
/**
 *  纤细体
 */
static NSString *const CLPingFangSC_Thin = @"PingFangSC-Thin";
/**
 *  细体
 */
static NSString *const CLPingFangSC_Light = @"PingFangSC-Light";
/**
 *  中黑体
 */
static NSString *const CLPingFangSC_Medium = @"PingFangSC-Medium";

@implementation UIFont (CLFont)

+ (UIFont *)cl_systemFontOfSize:(CGFloat)fontSize {
    NSString *fontName = ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) ? @"PingFangSC-Regular" : @"HelveticaNeue";
    
    UIFont *font = [UIFont fontWithName:fontName size:fontSize];
    
    return font;
}
    
+ (UIFont *)cl_boldSystemFontOfSize:(CGFloat)fontSize {
    NSString *fontName = ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) ? @"PingFangSC-Medium" : @"HelveticaNeue-Medium";
    
    UIFont *font = [UIFont fontWithName:fontName size:fontSize];
    
    return font;
}
    
+ (UIFont *)cl_lightSystemFontOfSize:(CGFloat)fontSize {
    NSString *fontName = ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) ? @"PingFangSC-Light" : @"HelveticaNeue-Light";
    
    UIFont *font = [UIFont fontWithName:fontName size:fontSize];
    
    return font;
}

/**
 *  苹方极细体
 *
 *  @param fontSize 字体大小
 *
 */
+(instancetype) cl_fontForPingFangSC_UltralightFontOfSize:(CGFloat)fontSize
{
    return [UIFont fontWithName:CLPingFangSC_Ultralight size:fontSize];
}

/**
 *  苹方常规体
 *
 *  @param fontSize 字体大小
 *
 */
+(instancetype) cl_fontForPingFangSC_RegularFontOfSize:(CGFloat)fontSize
{
    return [UIFont fontWithName:CLPingFangSC_Regular size:fontSize];
}

/**
 *  苹方中粗体
 *
 *  @param fontSize 字体大小
 *
 */
+(instancetype) cl_fontForPingFangSC_SemiboldFontOfSize:(CGFloat)fontSize
{
    return [UIFont fontWithName:CLPingFangSC_Semibold size:fontSize];
}

/**
 *  苹方纤细体
 *
 *  @param fontSize 字体大小
 *
 */
+(instancetype) cl_fontForPingFangSC_ThinFontOfSize:(CGFloat)fontSize
{
    return [UIFont fontWithName:CLPingFangSC_Thin size:fontSize];
}

/**
 *  苹方细体
 *
 *  @param fontSize 字体大小
 *
 */
+(instancetype) cl_fontForPingFangSC_LightFontOfSize:(CGFloat)fontSize
{
    return [UIFont fontWithName:CLPingFangSC_Light size:fontSize];
}

/**
 *  苹方中黑体
 *
 *  @param fontSize 字体大小
 *
 */
+(instancetype) cl_fontForPingFangSC_MediumFontOfSize:(CGFloat)fontSize
{
    return [UIFont fontWithName:CLPingFangSC_Medium size:fontSize];
}

@end
